/*
** Функция возвращат объект XMLHttpRequest
*/
function getXmlHttpRequest()
{
	if (typeof XMLHttpRequest === 'undefined') {
	    XMLHttpRequest = function() {
	      try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
	        catch(e) {}
	      try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
	        catch(e) {}
	      try { return new ActiveXObject("Msxml2.XMLHTTP"); }
	        catch(e) {}
	      try { return new ActiveXObject("Microsoft.XMLHTTP"); }
	        catch(e) {}
	      throw new Error("This browser does not support XMLHttpRequest.");
	    };
	  }
	return new XMLHttpRequest();
}

function addMsg()
{
    alert('1');
		var req = new getXmlHttpRequest();
		if(req)
			{
			 
                req.open("POST", "/core/func.php?page=_addMsg", true);
			    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                req.onreadystatechange = function(){      
                    if(req.readyState==4 && req.status==200)  
                    //document.getElementById('allMsg').innerHTML += req.responseText; 
                }
			    req.send('name='+document.getElementById('name').value+"&msg="+document.getElementById('msg').value);
            }		
}